package com.os.sys.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.os.util.Tools;

public class SysOrg  implements Serializable{
	private static final long serialVersionUID = 1L; 
	private int org_id;
	private String org_name;
	private String org_code;
	private String org_order;
	private String org_comment;
	private int org_parent;
	private int org_level;
	private String org_name_parent;
	private String org_user_ids;
	private String org_key;
	private int org_enable=1;
	//机构中文标识
	private String org_key_cn;
	
	List<SysOrg> children = new ArrayList();
	

	public List<SysOrg> getChildren() {
		return children;
	}

	public void setChildren(List<SysOrg> children) {
		this.children = children;
	}

	public String getOrg_key_cn() {
		return org_key_cn;
	}

	public void setOrg_key_cn(String org_key_cn) {
		this.org_key_cn = org_key_cn;
	}

	public String getOrg_key() {
		return org_key==null?"":org_key;
	}

	public void setOrg_key(String org_key) {
		this.org_key = org_key;
	}

	public String getOrg_name_parent() {
		return org_name_parent;
	}

	public void setOrg_name_parent(String org_name_parent) {
		this.org_name_parent = org_name_parent;
	}

	public int getOrg_level() {
		return Tools.getCodeGrade(this.org_code, 2);
	}
	/**
	 * 提交组织代码头部， 如一级： 返回10,11,..., 如二级, 返回1001,1002,..
	 * @return
	 */
	public String getOrgCode_head() {
		int level = this.getOrg_level();
		if(level==1){
			 return this.org_code.substring(0,2);
		}else if(level==2){
			 return this.org_code.substring(0,4);
		}else if(level==3){
			 return this.org_code.substring(0,6);
		}else if(level==4){
			 return this.org_code.substring(0,8);
		}else if(level==5){
			 return this.org_code.substring(0,10);
		}else if(level==6){
			 return this.org_code;
		}
		return "";
	}

	public void setOrg_level(int org_level) {
		this.org_level = org_level;
	}

	public String getOrg_code() {
		return org_code;
	}

	public void setOrg_code(String org_code) {
		this.org_code = org_code;
	}

	public String getOrg_comment() {
		return org_comment;
	}

	public void setOrg_comment(String org_comment) {
		this.org_comment = org_comment;
	}

	public int getOrg_id() {
		return org_id;
	}

	public void setOrg_id(int org_id) {
		this.org_id = org_id;
	}

	public String getOrg_name() {
		return org_name;
	}

	public void setOrg_name(String org_name) {
		this.org_name = org_name;
	}

	public String getOrg_order() {
		return org_order;
	}

	public void setOrg_order(String org_order) {
		this.org_order = org_order;
	}

	public int getOrg_parent() {
		return org_parent;
	}

	public void setOrg_parent(int org_parent) {
		this.org_parent = org_parent;
	}
//	org_id
//	org_name
//	org_code
//	org_order
//	org_comment
//	org_parent

	public String getPrintStr(){
		String Str = "";
		Str = "[(org_id,"+org_id+"),"+ 
		             "(org_name,"+org_name+"),"+ 
		             "(org_code,"+org_code+")" +
		             "(org_comment,"+org_comment+")" +
		             "(org_order,"+org_order+")" +
		             "(org_parent,"+org_parent+")" +
		             		"]";
		return Str;
	}
    
	public void printMe(){
		System.out.print(this.getPrintStr() );
		
	}

	public String getOrg_user_ids() {
		return org_user_ids;
	}

	public void setOrg_user_ids(String org_user_ids) {
		this.org_user_ids = org_user_ids;
	}

	public int getOrg_enable() {
		return org_enable;
	}

	public void setOrg_enable(int org_enable) {
		this.org_enable = org_enable;
	}
	
	private String region_code;
	private String region_name;


	public String getRegion_code() {
		return region_code;
	}

	public void setRegion_code(String region_code) {
		this.region_code = region_code;
	}

	public String getRegion_name() {
		return region_name;
	}

	public void setRegion_name(String region_name) {
		this.region_name = region_name;
	}
	
	
	
	

}
